<?php
namespace SixShop\News\Model;

use think\Model;
use think\model\concern\SoftDelete;

class News extends Model
{
    use SoftDelete;

    protected $name = 'news';
    protected $pk = 'id';
    protected $autoWriteTimestamp = 'datetime';
    protected $deleteTime = 'delete_time'; // 软删除时间戳字段

    /**
     * 定义与新闻分类表的关联关系
     *
     * @return \think\model\relation\BelongsTo
     */
    public function category()
    {
        return $this->belongsTo(NewsCategory::class, 'category_id', 'id');
    }
}